package com.heima.comment.utils;

import com.heima.model.user.entity.ApUser;

public class AppUserThreadLocalUtil {

    private final static ThreadLocal<ApUser> WM_USER_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 添加用户id
     *
     * @param user
     */
    public static void set(ApUser user) {
        WM_USER_THREAD_LOCAL.set(user);
    }

    /**
     * 获取用户id
     */
    public static ApUser get() {
        return WM_USER_THREAD_LOCAL.get();
    }

    /**
     * 清理用户id
     */
    public static void remove() {
        WM_USER_THREAD_LOCAL.remove();
    }
}
